<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .box{
        margin: 0 auto;
        width: 200px;
        position: relative;
        height: 200px;
        perspective: 1000px;
    }
    .box .outer{
        width: 100%;
        height: 100%;
        background-color: aqua;
        transition: all 0.5s ease;
    }
    .box .inner{
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transform-style: preserve-3d;
        backface-visibility: hidden;
        transform: translateY(110px) rotateX(-90deg);
        background-color: blue;
        transition: all 0.5s ease;
    }
    .box:hover .inner {
        opacity: 1;
        transform: rotateX(0deg);
    }

    .box:hover .outer {
        opacity: 0;
        transform: translateY(-110px) rotateX(90deg);
    }
</style>
<body>
    <div class="box">
        <div class="outer"></div>
        <div class="inner"></div>
    </div>
</body>
</html>